﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework5._8
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("请输入身份证号码：");
            string str = Console.ReadLine();
            char[] IDchars = str.ToCharArray();
            int Length = str.Length;
            while (Length!=18)
            {
                Console.Write("身份证号长度输入错误，请重新输入：");
                str = Console.ReadLine();
                Length = str.Length;
                IDchars = str.ToCharArray();
            }
            int count = 0;
            foreach (char item in IDchars)
            {
                if(item<'0'||item>'9')
                {
                    count++;
                }            
            }
            if (count!=0)
            {
                Console.Write("身份证号输入非数字字符，请重新输入：");
                str = Console.ReadLine();
                IDchars = str.ToCharArray();
            }
            Console.WriteLine($"身份证号输入正确，请确认您的身份证号为：{str}");
            Console.ReadKey();
        }
    }
}
